package com.jkhan.demo.inheritance;

/**
 * @ClassName AbstractTest
 * @Description TODO
 * @Author F117
 * @Date 2021/12/29 22:12
 **/
public class AbstractTest1 {
    public static void main(String[] args) {
        Person creature = new Student("hjk", 22);
        creature.breath();
        System.out.println("name: " + creature.name + " age: " + creature.age);
    }
}

abstract class Creature {
    public abstract void breath();
}

abstract class Person extends Creature {
    String name;
    int age;

    public Person() {

    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public abstract void eat();

    public void walk() {
        System.out.println("person walk");
    }
}

class Student extends Person {
    public Student(String name, int age) {
        super(name, age);
    }

    public Student() {

    }

    @Override
    public void eat() {
        System.out.println("student eat");
    }

    @Override
    public void breath() {
        System.out.println("student breath");
    }
}
